const target = [1, 2, 3];
const p = new Proxy(target, {
  get(target, key) {
    console.log('get~~~~~~~~~~~~');
    console.log('target:', target);
    console.log('key:', key);
    return target[key];
  },
  set(target, key, value, receiver) {
    console.log('set~~~~~~~~~~~~');
    console.log('target:', target);
    console.log('key:', key);
    console.log('value:', value);
    target[key] = value
    return true
  }
});

p.push(100)
/*
get~~~~~~~~~~~~
target: [ 1, 2, 3 ]
key: push
get~~~~~~~~~~~~
target: [ 1, 2, 3 ]
key: length
set~~~~~~~~~~~~
target: [ 1, 2, 3 ]
key: 3
value: 100
set~~~~~~~~~~~~
target: [ 1, 2, 3, 100 ]
key: length
value: 4 // 但其实此时length其实已经由于触发的第一次set 得到了更新了 也就说现在的值已经为4了
*/

// p[2] = 123
/*
set~~~~~~~~~~~~
target: [ 1, 2, 3 ]
key: 2
value: 123
*/
